#!/usr/bin/env node

const fs = require('fs');
const path = require('path');

const dir = path.join(__dirname, '../../../static')
const ifExist = fs.existsSync(dir);


function deleteAllFiles(dir) {
    const files = fs.readdirSync(dir);
    for (const file of files) {
        const curPath = path.join(dir, file);
        if (fs.statSync(curPath).isDirectory()) {
            deleteAllFiles(curPath)
        } else {
            fs.unlinkSync(curPath)
        }
    }
    fs.rmdirSync(dir);
}

if (ifExist) {
    deleteAllFiles(dir)
    // fs.mkdirSync(dir);
} else {
    // fs.mkdirSync(dir);
}

